		TITLE PUBCHECK - Copyright (c) SLR Systems 1994

		INCLUDE	MACROS

		PUBLIC	PUB_CHECK

		.DATA

		EXTERNDEF	SYMBOL_TPTR:TPTR_STRUCT

		EXTERNDEF	END_OF_RECORD:DWORD,TYPDEF_ANDER:DWORD,BUFFER_OFFSET:DWORD,PUB_OFFSET:DWORD,PUB_SIZE:DWORD
		EXTERNDEF	PUB_CV:DWORD

		EXTERNDEF	OPTI_MOVE:DWORD


		.CODE	PASS1_TEXT

		EXTERNDEF	DO_PUBLIC:PROC,OBJ_PHASE:PROC


;PUB_VARS	STRUC

;PC_SYMBOL_TPTR_EBP	DB	SIZEOF TPTR_STRUCT+SYMBOL_TEXT_SIZE DUP(?)

;PUB_VARS	ENDS


;FIX	MACRO	XX

;XX	EQU	([EBP-SIZEOF PUB_VARS].(XX&_EBP))

;ENDM


;FIX	PC_SYMBOL_TPTR


PUB_CHECK	PROC
		;
		;ESI IS OBJ_INPUT_DATA
		;RETURNS ESI UPDATED
		;
;		PUSH	EBP
;		MOV	EBP,ESP
		MOV	EAX,PUB_SIZE
;		SUB	ESP,SIZEOF PUB_VARS
;		ASSUME	EBP:PTR PUB_VARS

		PUSH	EDI
		TEST	EAX,EAX
		JNZ	PUB_CHECK32
		JMP	PUB_CHECK16

PUB_LOOP32:
		;
		;NOW, WE ENTER LOOP READING PUBLIC SYMBOLS AND OFFSETS
		;
		MOV	EDI,OFF SYMBOL_TPTR
		ASSUME	EDI:PTR TPTR_STRUCT
		GET_NAME_HASH	;TOO	;MUST PRESERVE EDX TILL INSTALL

		MOV	EAX,[ESI]
		ADD	ESI,4

		MOV	PUB_OFFSET,EAX
		MOV	BUFFER_OFFSET,ESI

;		SKIP_INDEX

		NEXT_INDEXI
		MOV	ECX,TYPDEF_ANDER

		AND	EAX,ECX		;SKIP IF NO CV THIS MODULE

		MOV	PUB_CV,EAX

		CALL	DO_PUBLIC
PUB_CHECK32:
		;
		;DO WE DO ANY MORE?
		;
		CMP	END_OF_RECORD,ESI
		JA	PUB_LOOP32

		POP	EDI
		JNZ	OOPS

		RET


OOPS:		CALL	OBJ_PHASE
		RET

PUB_LOOP16:
		;
		;NOW, WE ENTER LOOP READING PUBLIC SYMBOLS AND OFFSETS
		;
;		LEA	EDI,PC_SYMBOL_TPTR
		MOV	EDI,OFF SYMBOL_TPTR
		GET_NAME_HASH		;MUST PRESERVE EDX TILL INSTALL
		MOV	EAX,[ESI]
		MOV	BUFFER_OFFSET,ESI
		AND	EAX,0FFFFH
		ADD	ESI,2
		MOV	PUB_OFFSET,EAX

;		SKIP_INDEX

		NEXT_INDEXI
		MOV	ECX,TYPDEF_ANDER

		AND	EAX,ECX		;SKIP IF NO CV THIS MODULE

		MOV	PUB_CV,EAX

;		MOV	EAX,OFF SYMBOL_TPTR
		CALL	DO_PUBLIC
PUB_CHECK16:
		;
		;DO WE DO ANY MORE?
		;
		CMP	END_OF_RECORD,ESI
		JA	PUB_LOOP16
		POP	EDI
		JNZ	OOPS
		RET

PUB_CHECK	ENDP


		END

